package com.wedo.mall.entity;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * Created by lxy on 2017/6/19.
 */

public class Banner implements Parcelable {
    /**
     * id : 32
     * image : http://oppxc09hv.bkt.clouddn.com/房3.jpg
     * type : 1 广告类型（0/外链;1/商家;2/商品;3/详情）
     * content : ,10, 如type为1，则该处为商家id；如type为2，则该出为商品id;
     */

    public String id;
    public String image;
    public String type;
    public String content;
    public String url;

    public boolean url(){
        return TextUtils.equals("0",type);
    }

    public boolean shop(){
        return TextUtils.equals("1",type);
    }

    public boolean goods(){
        return TextUtils.equals("2",type);
    }

    public boolean detail(){
        return TextUtils.equals("3",type);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.image);

        dest.writeString(this.type);
        dest.writeString(this.content);
        dest.writeString(this.url);
    }

    public Banner() {
    }

    protected Banner(Parcel in) {
        this.id = in.readString();
        this.image = in.readString();
        this.type = in.readString();
        this.content = in.readString();
        this.url = in.readString();
    }

    public static final Parcelable.Creator<Banner> CREATOR = new Parcelable.Creator<Banner>() {
        @Override
        public Banner createFromParcel(Parcel source) {
            return new Banner(source);
        }

        @Override
        public Banner[] newArray(int size) {
            return new Banner[size];
        }
    };
}
